mybatis @MapperScan 解析 | 您所在的位置:网站首页 › 解决WARNSkipping MapperFactoryBean with name › mybatis @MapperScan 解析 |
大家好,又见面了,我是你们的朋友全栈君。 MapperScan 注解会引入 MapperScannerRegistrar,MapperScannerRegistrar 实现了 ImportBeanDefinitionRegistrar,可以向 beanFactory 中 注册 BeanDefinition,具体注入的过程是通过 ClassPathMapperScanner 实现的。 public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) { AnnotationAttributes annoAttrs = AnnotationAttributes.fromMap(importingClassMetadata.getAnnotationAttributes(MapperScan.class.getName())); ClassPathMapperScanner scanner = new ClassPathMapperScanner(registry); // this check is needed in Spring 3.1 if (resourceLoader != null) { scanner.setResourceLoader(resourceLoader); } Class markerInterface = annoAttrs.getClass("markerInterface"); if (!Class.class.equals(markerInterface)) { scanner.setMarkerInterface(markerInterface); } Class |
CopyRight 2018-2019 实验室设备网 版权所有 |